/*
 * Copyright (C) 2004-2016 7dub.cn All rights reserved
 * Author: caozhongsheng
 * Date: 2016年11月12日
 */
package cn.dub.scarecrow.common.config.db;

import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 数据库配置
 * @author caozhongsheng
 *
 */
@Configuration
@AutoConfigureAfter(DataSourceConfig.class)
//@MapperScan(basePackages = { "cn.dub.scarecrow.dao" }, annotationClass = Dao.class)
public class DBConfig {

	@Bean
    public MapperScannerConfigurer mapperScannerConfigurer() {
        MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
        mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory");
        mapperScannerConfigurer.setBasePackage("cn.dub.scarecrow.dao");
        mapperScannerConfigurer.setAnnotationClass(Dao.class);
        return mapperScannerConfigurer;
    }
}
